﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace XNA_Utilities.UserInterface
{

    /// <summary>
    /// The basic class that all other Interface Members are based on.
    /// </summary>
    public abstract class UserInterfaceBaseElement : DrawableGameComponent
    {
        //Create Gets/Sets for these
        Color backgroundColor;
        Texture2D texture;
        
        //Private members that do not need Get/Set methods.
        private SpriteBatch spriteBatch;
        private Rectangle rectangle;

        /// <summary>
        /// Create a new UserInterfaceBaseElement, an Element that can be drawn.
        /// </summary>
        /// <param name="X_Position">The X-Position of the top-Left Corner of the Element</param>
        /// <param name="Y_Position">The Y-Position of the top-Left Corner of the Element</param>
        /// <param name="Width">The Width of the Element</param>
        /// <param name="Height">The Height of the Element</param>
        public void UserInterfaceBaseElement(int X_Position, int Y_Position, int Width, int Height)
        {
            rectangle = new Rectangle(X_Position, Y_Position, Width, Height);
            spriteBatch = new SpriteBatch(GraphicsDevice);
            texture = new Texture2D(GraphicsDevice, Width, Height);
        }

        /// <summary>
        /// Draws this element on the screen.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Draw(GameTime gameTime)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(texture, rectangle, backgroundColor);
            spriteBatch.End();
            base.Draw(gameTime);
        }

    }

    /// <summary>
    /// A 2D square that can house other UserInterfaceElements
    /// </summary>
    public class Frame : UserInterfaceBaseElement
    {
        //Create a Get/Set for this
        List<UserInterfaceBaseElement> children;

        public Frame()
        {            
            children = new List<UserInterfaceBaseElement>();
        }
    }

    /// <summary>
    /// A Button that can be placed as part of a User Interface
    /// </summary>
    public class Button : UserInterfaceBaseElement
    {
        //Add in the stuff that we might need for a button, like text, textcolor, etc...
        //Create the Get/Sets for these.

        public Button()
        {

        }
    }

}
